/*
 * ReleaseBuzzer.hpp
 *
 *  Created on: 25.05.2014
 *      Author: philipp
 */

#ifndef RELEASEBUZZER_HPP_
#define RELEASEBUZZER_HPP_

#include "wiringPi.h"

/*
 * the release buzzer locks/unlocks the door.
 */
class ReleaseBuzzer {
private:
	/*
	 * the pin the release buzzer is connected to.
	 */
	static const int PIN = 23;

	/*
	 * private for singleton pattern.
	 */
	ReleaseBuzzer();
	ReleaseBuzzer(const ReleaseBuzzer &);
	ReleaseBuzzer(ReleaseBuzzer &&);
	ReleaseBuzzer &operator=(const ReleaseBuzzer &);
	ReleaseBuzzer &operator=(ReleaseBuzzer &&);
	~ReleaseBuzzer();
public:
	/*
	 * returns the release buzzer. will initialize it if there is not yet an instance.
	 */
	static ReleaseBuzzer &getInstance();
	/*
	 * returns true if the release buzzer is currently open (the door is NOT locked)
	 */
	bool isOpen() const;
	/*
	 * unlocks the door.
	 */
	void open();
	/*
	 * locks the door.
	 */
	void close();
};

#endif /* RELEASEBUZZER_HPP_ */
